package com.yuanluludev.app.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
import com.yuanluludev.app.R;
import com.yuanluludev.lib_refreshlayout.EmptyLayout;


/**
 * CustomEmptyLayout
 * yuanLuLu
 */
public class CustomEmptyLayout extends EmptyLayout {

    public CustomEmptyLayout(Context context) {
        super(context);
    }

    public CustomEmptyLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomEmptyLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        setView_empty_layout(R.layout.view_empty);
        setView_error_layout(R.layout.view_error);
        setView_notnet_layout(R.layout.view_notnet);
    }

    public void setTextretry(String msg) {
        TextView textretry = this.findViewById(R.id.textretry);
        textretry.setText(msg);
    }

    @Override
    public void showError(String message) {
        if ("无网络连接，请检查网络是否正常".equals(message)) {
            showNet();
        } else {
            super.showError(message);
        }
    }
}
